From: Debian Science Maintainers Date: Sat, 2 Mar 2019 14:59:35 +0000 (+0000) Subject: Fix shape mismatch errors in MICE imputation X-Git-Tag: archive/raspbian/0.11.1-2+rpi1~2^2^2~9 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=0674b7fed4d44591570d2dab3a64a1f768890edb;p=statsmodels.git Fix shape mismatch errors in MICE imputation numpy/pandas no longer allows assigning an nx1 2D value at a 1D index Author: Peter "thequackdaddy" Quackenbush, Josef "josef-pkt" Perktold Origin: upstream https://github.com/statsmodels/statsmodels/commit/df92bde1a85c238db9561304a196dbc618cfeaa1 https://github.com/statsmodels/statsmodels/commit/0871eba510e7ebe8aa9323f4f3ee50226576ed29 Forwarded: not-needed Gbp-Pq: Name imputation_broadcasting.patch --- diff --git a/statsmodels/imputation/mice.py b/statsmodels/imputation/mice.py index a7778c4..233a751 100644 --- a/statsmodels/imputation/mice.py +++ b/statsmodels/imputation/mice.py @@ -392,7 +392,7 @@ class MICEData(object): ix = self.ix_miss[col] if len(ix) > 0: - self.data[col].iloc[ix] = vals + self.data[col].iloc[ix] = np.atleast_1d(vals) def update_all(self, n_iter=1): @@ -1076,7 +1076,7 @@ class MICEData(object): ix = dxi[[jj, ir]] iz = ixm[[jj, ix]] - imputed_miss = np.array(endog_obs[iz]) + imputed_miss = np.array(endog_obs[iz]).squeeze() self._store_changes(vname, imputed_miss)